<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取鼠标位置</title>
    <style>
        *{
            margin: 0px;
        }
    </style>
    <script>
        function f1(){
            console.log("当前鼠标所在的x轴坐标:"+event.clientX);
            console.log("当前鼠标所在的y轴坐标:"+event.clientY);
        }
    </script>
</head>
<body>
<div style="width: 200px;height: 100px;background: red;" onmousemove="f1()"></div>
</body>
</html>